package cn.zeal4j.domain;

import lombok.*;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Administrator
 * @file Hibernate-Tutorial
 * @create 2020 09 27 10:13
 */
@Entity
@Table(name = "b")
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class EntityB implements Serializable {
    private static final long serialVersionUID = -1308014214512822794L;
    @Id
    @GeneratedValue(generator = "increment", strategy = GenerationType.AUTO)
    @GenericGenerator(name = "increment", strategy = "increment")
    private Integer id;
    private String info;

    @OneToMany(mappedBy = "entityB", cascade = {CascadeType.ALL})
    private Set<EntityA> entityASet = new HashSet<>();
}
